# trace generated using paraview version 5.10.0
#
working_dir = "/home/hpc/program/IDEALS3D/DEAD/AutoDecoder/Models/Eikonal/4-6"
vts_file_name="0.0#N7"

#### import the simple module from the paraview
from paraview.simple import *

# create a new 'XML Structured Grid Reader'
target_vts = XMLStructuredGridReader(FileName=[working_dir+"/"+vts_file_name+".vts"])

# get active view
renderView1 = GetActiveViewOrCreate('RenderView')

# show data in view
target_vtsDisplay = Show(target_vts, renderView1)

# trace defaults for the display properties.
target_vtsDisplay.Representation = 'Outline'

# reset view to fit data
renderView1.ResetCamera()

# update the view to ensure updated data information
renderView1.Update()

# hide data in view
Hide(target_vts, renderView1)

# create a new 'Iso Volume'
isoVolume1 = IsoVolume(Input=target_vts)

# Properties modified on isoVolume1
isoVolume1.InputScalars = ['POINTS', 'define_marker']
isoVolume1.ThresholdRange = [0.5, 2.0]

# show data in view
isoVolume1Display = Show(isoVolume1, renderView1)

# trace defaults for the display properties.
isoVolume1Display.Representation = 'Surface'

# hide data in view
Hide(isoVolume1, renderView1)

# create a new 'Contour'
contour1 = Contour(Input=isoVolume1)

# Properties modified on contour1
contour1.Isosurfaces = [-0.002]

# show data in view
contour1Display = Show(contour1, renderView1)

# trace defaults for the display properties.
contour1Display.Representation = 'Surface'

# update the view to ensure updated data information
renderView1.Update()

# change solid color
contour1Display.DiffuseColor = [1.0, 0.0, 0.0]

# set active source
SetActiveSource(isoVolume1)

# create a new 'Iso Volume'
isoVolume2 = IsoVolume(Input=isoVolume1)

# Properties modified on isoVolume2
isoVolume2.ThresholdRange = [0.0, 50.0]

# show data in view
isoVolume2Display = Show(isoVolume2, renderView1)

# trace defaults for the display properties.
isoVolume2Display.Representation = 'Surface'

# hide data in view
Hide(isoVolume1, renderView1)

# show color bar/color legend
isoVolume2Display.SetScalarBarVisibility(renderView1, False)

# update the view to ensure updated data information
renderView1.Update()

# turn off scalar coloring
ColorBy(isoVolume2Display, None)

# reset view to fit data
renderView1.ResetCamera()

# current camera placement for renderView1
#renderView1.CameraPosition = [-1.1733679081156507, -2.721868099824966, -3.2596504885633077]
renderView1.CameraPosition = [-2, -2, -2]
#renderView1.CameraFocalPoint = [0.7095798552036285, 0.21344321966171265, 1.5515306293964386]
#renderView1.CameraViewUp = [-0.5334919059913795, 0.7986507272929785, -0.2784661595887045]
#renderView1.CameraParallelScale = 0.1
renderView1.CameraViewUp = [0.0, 1.0, 0.0]

renderView1.ResetCamera()

# Properties modified on renderView1
renderView1.OrientationAxesVisibility = 0

# set scalar coloring
ColorBy(isoVolume2Display, ('POINTS', 'u'))

# rescale color and/or opacity maps used to include current data range
isoVolume2Display.RescaleTransferFunctionToDataRange(False, True)

# show color bar/color legend
isoVolume2Display.SetScalarBarVisibility(renderView1, True)

# get color transfer function/color map for 'u'
uLUT = GetColorTransferFunction('u')

# get opacity transfer function/opacity map for 'u'
uPWF = GetOpacityTransferFunction('u')

#ImportPresets(filename='/home/hpc/Documents/color/All_idl_cmaps.xml')

#ImportPresets(filename='/home/hpc/Documents/color/All_mpl_cmaps.xml')

# Apply a preset using its name. Note this may not work as expected when presets have duplicate names.
uLUT.ApplyPreset('flag', True)

# rescale color and/or opacity maps used to exactly fit the current data range
isoVolume2Display.RescaleTransferFunctionToDataRange(False, True)

Interact()